package com.raycloud.java.dada.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by hechuan on 2017/6/10.
 *
 * 日期转换类
 */
public class DateFormatUtil {

    public static Long dateToUnixTime(Date date){

        return date.getTime();
    }

    public static Long stringToDate(String dateStr){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = null;
        try{
             date = sdf.parse(dateStr);
        }catch (Exception e){
           e.printStackTrace();
        }
        return date.getTime()/1000;
    }

}
